Method and appartatus for equalizing load of streaming media server

ABSTRACT

The invention deals with a method and apparatus of realizing load equalizing on the steam media server. The load equalizer is placed in front of the steam media server and the servers are trusted by the load equalizer. Each server has its private IP address, and the load equalizer is in charge of its exoteric IP address, which comprises the processing module of the client port, the processing module of the server port, and the main control module. The processing module of the client port is set to recognize and transfer the data from the client. The processing module of the server port is set to recognize and transfer the data from the server. The main control module orderly matches the data required to be processed further to determine which actual server will process the data, and to establish the list of the stream rules between the processing module of the client port and the processing module of the server port.

FIELD OF THE INVENTION

The present invention relates to a method and apparatus for equalizing load on the stream media servers.

BACKGROUND OF THE INVENTION

As stream media becomes more and more popular, people have more requirements for serviceability of stream media servers. Usually, a high-performance server only supports several thousands of concurrent connections and can't meet the access demand of vast users. To solve this problem, a plurality of servers may be used, i.e., the user access is distributed to a plurality of servers to significantly increase the number of concurrent users that can be supported; in addition, as the number of servers expands, the number of users that can be supported will grow accordingly. In this way, during the access to stream media, the stream media servers will not be the bottleneck.

Currently, above problem is usually solved with DNS load equalizing method. With that method, a plurality of IP addresses can be obtained when the same domain name is parsed, and the IP addresses map to a plurality of servers. Thus the requests to a domain name are distributed to a plurality of servers with private IP addresses. Though this method is simple and easy to implement, its drawback is also obvious: difference between the servers cannot be found and more requests cannot be distributed to servers with higher performance; in addition, it is unable to detect the current status of the servers, therefore, the requests may even be allocated to a single server; what's more, too many public IP addresses are occupied, which is a fatal defect for an environment with limited public IP addresses. The method of realizing load equalizing on stream media servers described hereinafter can solve said problem.

SUMMARY OF THE INVENTION

The object of the present invention is to provide a method and apparatus for equalizing load on the stream media servers so that a server cluster uses only one or several public IP addresses and employs specific load equalizing policies to implement load equalizing, so as to solve the problem regarding insufficient processing capacity of a single server during access to the stream media servers.

According to an aspect of the present invention, it is provided a method for equalizing load on the stream media servers, a load equalizer is disposed before the stream media servers, which are trusted by the load equalizer, each server has its private IP address, and the load equalizer is in charge of the exoteric IP address and comprises a processing module of the client port, a processing module of the server port, and a main control module, said method comprises the following steps: the processing module of the client port being set to intercept TCP requests from the client with the first-class steam rule at the client port and to forward the requests to the main control module to obtain the address of actual destination server; the main control module sending SYN packets from the client to the actual server; the processing module of the server port being set to intercept response from the actual server with first-class steam rule at the server port and to forward the response to the main control module to accomplish SYN responses of actual server; the main control module creating the second-class steam rule at the client port and the server port respectively according to the address and SYN information of the actual server so as to establish a RTSP control channel between the two ports; the main control module creating the third-class rule at the client port and the server port respectively according to certain information of the control channel so as to establish a data channel between the two ports.

In addition, the first-class stream rule at the client port and the first-class stream rule at the server port are default rules with low priority, respectively.

Furthermore, the second-class stream rule at the client port and the second-class stream rule at the server port are RTSP classifying rules, i.e., classifying rules for the control channel.

Furthermore, the third-class steam rule at the client port and the third-class steam rule at the server port are RTP/RTCP classifying rules, i.e., classifying rules for the data channel.

According to another aspect of the present invention, it is provided a load equalizer for realizing equalizing load on the stream media servers.

Said load equalizer is before the stream media servers, which are trusted by said load equalizer, each server has its private IP address, and said load equalizer is in charge of the exoteric IP address, the load equalizer comprises: a processing module of the client port, which is set to recognize and forward the data from the client to the main control module of the load equalizer or directly to the actual server according to the actions defined in the matched rule list, a processing module of the server port, which is set to recognize and forward the data from the server to the main control module of the load equalizer or directly to a client according to the actions defined in the matched rule list, and a main control module, which is set to matches the data required to be processed further with rules to determine which actual server will process the data and to establish the list of the stream rules between the processing module of the client port and the processing module of the server port.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows the working scenario of the load equalizer.

FIG. 2 is the schematic diagram of the stream media load equalizer.

FIG. 3 shows the establishing process of PTSP control flow.

DETAILED DESCRIPTION OF THE EMBODIMENTS

The definitions of the abbreviations in the present invention are as follows:

-   -   TCP: Transport Control Protocol     -   UDP: User Datagram Protocol     -   SYN: Synchronization ID, when a client initiates a new         connection request, SYN=1, after the connection is established,         SYN=0 for other packets (See TCP/IP protocol)     -   ACK: answer to command, when an answer is given to a command,         ACK is set, i.e., ACK=1     -   RTSP: Real Time Stream Protocol     -   RTP: Real-Time Transport Protocol     -   RTCP: Real-Time Transport Control Protocol     -   DNS: Domain Name Server     -   VIP: Virtual IP Address     -   URL: Uniform Resource Locator, a method to indicate the position         of information on WWW servers on Internet

The method for realizing load equalizing of stream media servers may be software or hardware.

The working scenario is: a load equalizer is disposed before the stream media servers, which are trusted by the load equalizer, each server has its private IP address, and the load equalizer is in charge of the exoteric IP address (also referred as VIP). All of the customer access is directed to the VIP. The association between the load equalizer and the stream media server is shown in FIG. 1: suppose there are 4 stream media servers 1, 2, 3 and 4, and each of which has its own private IP address, for example, 10.110.9.5 for the first server, 10.110.9.6 for the second server, 10.110.9.7 for the third server, and 10.110.9.9 for the fourth server; the servers can provide the same service, i.e., contain the same content. Suppose the processing capacity of the servers is limited, for example, each of them supports 100 concurrent connections. The IP address of the load equalizer before them is the public and exterior IP address, for example, 202.11.2.10; when a user wants to access the stream media service provided at that site from INTERNET, he/she may initiate a request to the server cluster with the destination IP address 202.11.2.10, which maps to the load equalizer instead of any of the 4 actual servers. The load equalizer receives the request and will allocate it to a specific server of the 4 actual servers according to certain policies. Above case shows the scenario of a single user request. Now, suppose that the site is playing a good movie, a plurality of request packets will flow to the site. Therefore, one server is insufficient to support the requests due to its limited capacity (100 concurrent connections). The problem can be solved with a load equalizer. Similar to above description, the load equalizer will distribute the requests to different actual servers so as to realize load-sharing; in this way, the servers can support 400 concurrent connections; if more concurrent connections are required, more actual servers can be added after the load equalizer.

The processing framework for stream media load equalizing mainly comprises a processing module at the client port, a processing module at the server port, and a main control module, as shown in FIG. 2. The processing module of the client port is set to recognize and forward the data from the client to the main control module of the load equalizer or directly to the actual server according to the actions defined in the matched rule list, the processing module of the server port is set to recognize and forward the data from the server to the main control module of the load equalizer or directly to a client according to the actions defined in the matched rule list, and the main control module is set to matches the data required to be processed further with rules to determine which actual server will process the data and to establish the list of the stream rules between the processing module of the client port and the processing module of the server port, such as CC2, CC3, CS2 and CS3. CC1 and CS1 are default rule lists that are created at the beginning of the processing work (see Table 1 and Table 2).

Usually, the stream media protocols commonly used for stream media include RTSP and RTP/RTCP, wherein RTSP is used to transmit control information in the stream media; while RTP/RTCP is used to transmit data information in the stream media. Actually, the purpose of the steps of the load equalizer is to establish the control channel and the data channel between the processing module of the client port and the processing module of the server port; and the control channel is represented by CC2 and CS2 in the load equalizer (see Table 1 and Table 2); whenever the lists are created, the RTSP control channel is established, and the data can be forwarded directly through the channel. The data channel is represented by CC3 and CS3 in the load equalizer; whenever the lists are created, the data channel is established, and the data can be forwarded directly through the channel.

Therefore, there are two data structures in the load equalizer, i.e., stream rule list at the client port (shown as Table 1) and stream rule list at the server module (shown as Table 2). Hereinafter we describe how they are created.

There are two rule lists in all: the rule list for the processing module of the client port and the rule list for the processing module of the server port, and they intercept data packets from the client and the server respectively. Each rule list comprises 3 classes of rules, the first-class rules are permanent rules, such as CC1 and CS1, which are set during initialization and designed to intercept packets for which the control channel and the data channel have not been established and to forward them to the main control module, which, according to the packets, creates the second-class rules, such as CC2 and CS2, i.e., the control channel, and then creates the data channel such as CC3 and CS3 according to the information of the control channel. In this way, after the control channel and the data channel are established, the data belonging to the same stream can be transmitted through the channels. Hereinafter we will describe them in detail.

In order to describe the entire process of implementing load equalizing for stream media, take a RTSP session for example, which is initiated by a client with the IP address CA, the port CP and the destination address VIP and the port 554 (default port for stream media RTSP)). FIG. 3 shows every step of connection establishment and data transmission, and the names in FIG. 3 are: CLIENT, CLIENT PORT—client port of the load equalizer, POWERPC—main control module, SERVER PORT—server port of the load equalizer, and SERVER.

FIG. 3 only shows the establishing steps of the RTSP control channel (i.e., steps 1 to 16) without showing the establishing steps of data channel. This is because the establishment of data channel is based on the control channel through extracting control data information. Hereunder the establishing process of the data channel is described. It is obvious that the establishment of the data channel (RTP/RTCP) is accomplished after the control channel is established, i.e., the device detects the response of the server to the “SETUP” packet from the client through the control channel and obtain RTP/RTCP port number information from said response to get necessary information to establish the RTP/RTCP data channel, then the RTP/RTCP data channel is established.

1. The client initiates a TCP request (SYN=1 because it is a new request) with the CSEQ ID; the request is intercepted at the client port and is matched with List CC1 according to the stream class list (shown as Table 1) (it should be noted that because it is the first packet and its steam rule has not been created, so it can only be matched with CC1 with low priority, said rule forwards the TCP request to CPU (i.e., the main control module) to process; (steps 1 and 2)

2. The CPU simulates the server to return a SYN response; (steps 3 and 4)

3. The client receives the response and then initiates a RTSP request, which is intercepted by the rule CC1 at the client port and transferred to CPU (step 5); The CPU identifies the RTSP request, parses it to obtain the URL, and performs matching operation for the URL to obtain the address of the actual destination server. In addition, it should be determined whether “SETUP” is used in said method; if yes, it will record the RTSP session ID (Cseq); (steps 5 and 6)

4. The CPU sends the SYN packet with the ID CSEQ from the client to the actual server according to the obtained information of the actual server; (steps 7 and 8)

5. The server returns a SYN response with the ID “SSEQ” and the response ID CSEQ+1; at the server port, the SYN response is intercepted by CS1 in the rule list 2 and then transferred to the CPU. The server accomplishes the SYN response. At the same time, the stream class rule CC2 and the stream class rule CS2 are created at the client port and at the server port respectively according to the IP address of the actual server and SSEQ, as shown in Table 1 and Table 2. In this way, the RTSP control channel is established. Later, the control information belonging to the same stream can be transferred through the channel; (steps 9 and 10)

6. The CPU sends the RTSP packet with the ID CSEQ+1 and the response ID SSEQ+1 from the client to the actual server (steps 11 and 12); next, data can be transferred between the client and the server directly (steps 13, 14, 15 and 16).

7. The server receives the RTSP request packet and initiates a RTSP response, which is intercepted by the server port of the load equalizer and matched with CS2; the response ID is converted accordingly (from SSEQ+1 to DSEQ+1), and the session response ID (Cseq) is checked to verify whether it is identical to the “SETUP” session ID (Cseq) of the same stream from the client; if yes, it indicates the packet is the response packet for the last “SETUP” request, and the response packet will be transferred to the CPU. Then the process goes to step 8; otherwise it goes to step 9.

8. The CPU parses the response packet and extracts RTP/RTCP port numbers (including port numbers of the client and the server) from the response packet to the “SETUP” packet. RTP/RTCP stream rule lists such as CC3 in Table 1 and CS3 in Table 2 are added at the client port and the server port respectively. In this way, the RTP/RTCP direct channel is established. At the same time, the connection between CC2 and CC3 and the connection between CS2 and CS3 are established, i.e., once the RTSP stream in CC2 is known, the corresponding RTP/RTCP stream in CC3 is also known, in other words, whenever CS2 is known, the corresponding CS3 is known; as the result, the stream of a session (including RTSP and RTP/RTCP) can be deleted completely when the session ended. Then the process goes to step 9.

9. The packet with converted ID is forwarded directly to the client according to the forwarding path in the matched rule.

Above is the establishing process of the entire RTSP and the corresponding RTP/RTCP stream rule list. However, it is not that once the stream rule list is established the CPU will not participate in the session. According to the rule list of client port (see Table 1, wherein one of the methods is CMP “SETUP”), when CC2 is matched, the next operation is to compare it with “SETUP” to determine whether it is a request for “SETUP”; if not, the request is forwarded as route information; if yes, the request is forwarded to the CPU, and the RTSP session ID of the request will be recorded, just like above description. At the same time, the ID is transferred to the corresponding rule of the server port. In case the session ID of an RTSP response from said corresponding rule is identical to that of the last request, it indicates that the response is the response to the last “SETUP” request, and then the response is transmitted to the CPU to extract the RTP/RTCP port number, RTP/RTCP stream rule lists are created at the server port and the client port, and then the response as the route information in the rule. Certainly, if the server response is not the response to “SETUP”, the response will be forwarded as route information in the rule.

Processing Process at the Client Port

First, the client initiates a RTSP request to the server for the service with the destination IP address “VIP”, which is the exoteric public IP address for all servers behind the load equalizer and trusted by the load equalizer; when the client port obtains the data, it forwards the data to a classifier for classifying. The rule list 1 (stream rule list at the client port) of the classifier is shown as follows: TABLE 1 RTSP(RTP/RTCP) stream rule list at the client port Rule ID SD: DD: SP: DP: P: FLAG Type Priority Action CC1 *: VIP: *: 554: TCP: SYN Perm P1 To CPU CC2 CD: VIP: CP: 554: TCP: ANY Temp P2 ID conversion and com- parison “SETUP” CC3 CD: VIP: CSP: CDP: UDP: ANY Temp P3 To actual server

The classifier processes the packet according to the information in layer 2, 3 and 4 in the packet. “Action tag” and “meta information” are associated with the classifier and both of them define how to process a data packet. The symbols in above table are defined as follows:

-   -   Rule ID: Stream Rule ID     -   SD: Source IP address     -   DD: Destination IP address     -   SP: Source port No.     -   DP: Destination Port address     -   P: Protocol Number     -   FLAG: indicates SYN or ASN     -   Type: indicates whether the rule is PERM (permanent) or TEMP         (temporary)     -   Priority: P1—low priority, P2—high priority, if CC2 or CC3 don't         match, CC1 will be applied.

Note: there are two types of classifiers: permanent classifier and temporary classifier. Permanent classifiers are created during initialization of the switch and can only be changed through modifying the configuration data. Temporary classifiers are created or deleted as the connections are established or deleted. In addition, each classifier has its priority, and the classifier with higher priority will take the precedence in case of any conflict. In the following example, priority Pi is higher than Pj if i>j.

It is obvious that there are 3 types of rules at the client port:

1. The TCP SYN packet matching to port 554 will be transmitted to the CPU directly;

2. Steam rule packets matching to port 554 will be matched, the RTSP method name will be compared with “SETUP” after matching operation;

3. The stream matching to RTP/RTCP will be transferred to the server after matching operation.

Note:

1. For rule CC2, besides comparing with “SETUP”, the actions also include changing ID and transferring to the destination server after matching.

2. For rule CC3, the actions only include transferring to the destination server without changing ID.

Processing Process at the Server Port

The stream rules CC2 and CS2 are established at the client port and the server port respectively after the load equalizer shake hands with the server for three times. The stream rule list at the client port is described above. Hereunder we describe the stream rule list 2 at the server port: TABLE 2 RTSP(RTP/RTCP) Stream Rule List at the Server Port Rule ID SD: DD: SP: DP: P: FLAG Type Priority Action CC1 *: VIP: *: 554: TCP: SYN Perm P1 To CPU CC2 CD: VIP: CP: 554: TCP: ANY Temp P2 ID change, to CPU/cInt CC3 CD: VIP: CSP: CDP: UDP: ANY Temp P3 To client Wherein:

-   -   Rule ID: Stream Rule ID     -   SD: Source IP address     -   DD: Destination IP address     -   SP: Source port No.     -   DP: Destination address     -   P: Protocol Number     -   FLAG: indicates SYN or ASN     -   Type: indicates whether the rule is PERM (permanent) or TEMP         (temporary)     -   Priority: P1—low Priority, P2—high Priority, if CC2 and CC3         don't match, CC1 will be applied.

Note: there are two types of classifiers: permanent classifier and temporary classifier. Permanent classifiers are created during initialization of the switch and can only be changed through modifying the configuration data. Temporary classifiers are created or deleted as the connections are established or deleted. In addition, each classifier has its priority, and the classifier with higher priority will take the precedence in case of any conflict. In the following example, priority Pi is higher than Pj if i>j.

The CPU parses the RTSP request to obtain URL and then performs matching operation for the URL to obtain the address of actual server. Next, it forwards the request packet from the client to the address of the actual server; after three handshaking operations, The CS2 is established (as described above); then all RTSP responses sent by the server will be intercepted by CS2; after CS2 intercepts a RTSP response, it converts the response ID and then detects whether the FLAG is set; if the FLAG is not set, the RTSP response is sent to the client directly as the route information; if the FLAG is set, CS2 will compare the session ID (Cseq) with the provided ID; if they are equal, the packet will be sent to the CPU; otherwise the packet is routed to the client directly.

The CS2 parses the response to “SETUP”, and obtains RTP/RTCP port number and establishes CC3 and CS3 between the client port and the server port (as described above); for CS3, any matched response will be routed directly; however, certain association shall be established between CS3 and corresponding RTSP CS2 so that the session can be deleted completely when necessary.

Therefore, there are 3 rule classes at the server port, just like at the client port:

-   -   1. The TCP SYN packet matching to port 554 will be transmitted         to the CPU directly;     -   2. Steam rule packets matching to port 554 will be forwarded         according to specific circumstances after matching operation;     -   3. The stream matching to RTP/RTCP will be transmitted to the         client after matching operation.         Processing Steps at the Main Control Module

The processing steps at the main control module (i.e., CPU) mainly comprise:

-   -   1. Processing SYN packets (all SYN packets from the client will         be processed by the CPU);     -   2. Processing “SETUP” request packets from the client (recording         their IDs, and then sending the IDs to corresponding rules at         the server port); processing “SETUP” response packets from the         server (parsing the packets and extracting the information of         RTP/RTCP port);     -   3. Creating and distributing rule lists including RTSP rules and         RTP/RTCP rules.

The above description explains the load equalizing process of stream media and presents a method of realizing load equalizing.

As described above, the invention can effectively solve the problem of insufficient serviceability of stream media server. The load equalizing capability of the existing DNS load equalizing method is quite limited; however, the method of implementing load equalizing on stream media servers in the present invention is more intelligent, comprehensive and flexible.

Above load equalizing function can be implemented with a network processing unit, the route forwarding of data packets can be implemented with microcode of the network processing unit, and the analysis and process above TCP/IP layer can be achieved with the embedded CORE in the network processing unit. To achieve higher performance, a distributed processing system can be used. 

1. A method of equalizing load on stream media servers, in which a load equalizer being disposed before the stream media servers, which are trusted by the load equalizer, each server having its private IP address, and the load equalizer being in charge of the exoteric IP address and comprising a processing module of the client port, a processing module of the server port, and a main control module, said method comprising the following steps: the processing module of the client port being set to intercept TCP requests from the client with the first-class steam rule at the client port and to forward the requests to the main control module to obtain the address of actual destination server; the main control module sending SYN packets from the client to the actual server; the processing module of the server port being set to intercept response from the actual server with first-class steam rule at the server port and to forward the response to the main control module to accomplish SYN responses of actual server; the main control module creating the second-class steam rule at the client port and the server port respectively according to the address and SYN information of the actual server so as to establish a RTSP control channel between the two ports; the main control module creating the third-class rule at the client port and the server port respectively according to certain information of the control channel so as to establish a data channel between the two ports.
 2. A method according to claim 1, wherein the first-class stream rule at the client port and the first-class stream rule at the server port are default rules with low priority, respectively.
 3. A method according to claim 1, wherein the second-class stream rule at the client port and the second-class stream rule at the server port are Real Time Stream Protocol (RTSP) classifying rules, i.e., classifying rules for the control channel.
 4. A method according to claim 1, wherein the third-class steam rule at the client port and the third-class steam rule at the server port are Real-Time Transport Protocol/Real-Time Transport Control Protocol (RTP/RTCP) classifying rules, i.e., classifying rules for the data channel.
 5. A load equalizer for equalizing load on stream media servers, said load equalizer being disposed before the stream media servers, which are trusted by said load equalizer, each server having its private IP address, and said load equalizer being in charge of the exoteric IP address, the load equalizer comprising: a processing module of the client port, which is set to recognize and forward the data from the client to the main control module of the load equalizer or directly to the actual server according to the actions defined in the matched rule list; a processing module of the server port, which is set to recognize and forward the data from the server to the main control module of the load equalizer or directly to a client according to the actions defined in the matched rule list; and a main control module, which is set to matches the data required to be processed further with rules to determine which actual server will process the data and to establish the list of the stream rules between the processing module of the client port and the processing module of the server port.
 6. A method of equalizing load on stream media servers, the method comprising: setting a processing module of a client port of a load equalizer to intercept TCP requests from a client with a first-class steam rule at the client port and to forward the requests to a main control module of the load equalizer to obtain an address of a destination server, wherein the load equalizer is disposed before the stream media servers, each server having a private IP address, and the load equalizer being in charge of an exoteric IP address; the main control module sending SYN packets from the client to the destination server; setting a processing module of a server port of the load equalizer to intercept a response from the destination server with a first-class steam rule at the server port and to forward the response to the main control module to accomplish SYN responses of the destination server; the main control module creating a second-class steam rule at the client port and a second-class steam rule at the server port, according to an address and SYN information of the destination server, so as to establish a Real Time Stream Protocol (RTSP) control channel between the client port and the sever port; and the main control module creating a third-class rule at the client port and a third-class rule at the server port, according to certain information of the RTSP control channel, so as to establish a data channel between the client port and the sever port.
 7. A method according to claim 6, wherein the first-class stream rule at the client port and the first-class stream rule at the server port are default rules with low priority.
 8. A method according to claim 6, wherein the second-class stream rule at the client port and the second-class stream rule at the server port are RTSP classifying rules, i.e., classifying rules for the control channel.
 9. A method according to claim 2, wherein the third-class steam rule at the client port and the third-class steam rule at the server port are Real-Time Transport Protocol/Real-Time Transport Control Protocol (RTP/RTCP) classifying rules, i.e., classifying rules for the data channel.
 10. A load equalizer for equalizing load on stream media servers, each server having a private IP address, the load equalizer comprising: a client port and a processing module of the client port; a server port and a processing module of the server port; and a main control module, wherein the processing module of the client port recognizes and forwards data from a client to the main control module or directly to one of the servers according to actions defined in a matched rule list at the client port, wherein the processing module of the server port recognizes and forwards data from one of the servers to the main control module or directly to the client according to actions defined in a matched rule list at the server port, wherein the main control module matches data required to be processed further with rules to determine which server will process the data and to establish a list of the stream rules between the processing module of the client port and the processing module of the server port, and wherein the load equalizer is disposed before the servers and is in charge of an exoteric IP address. 